/**
 * 
 */
package com.naiterui.ehp.bp.constants;

import java.util.*;

/**
 * 就诊人与患者关系enum

 * @since 2.18
 */
public enum InquirerRelationEnum {

    ONESELF (0, "本人", 2),
    PARENTS (1, "父母",0),
    CHILDREN (2, "子女", 0),
    SPOUSE (3, "配偶",0),
    OTHER (4, "其他", 0);

    private Integer value;
    private String name;
    private Integer gender;

    InquirerRelationEnum(Integer value, String name, Integer gender) {
        this.value = value;
        this.name = name;
        this.gender = gender;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public static Map<Integer, String> getAll() {
        Map<Integer, String> map = new HashMap<>();
        Arrays.asList(InquirerRelationEnum.values()).stream().forEach(s -> map.put(s.getValue(), s.getName()));
        return map;
    }

    public static List<InquirerRelationEnum> getAllList() {
        return Arrays.asList(InquirerRelationEnum.values());
    }

    public static String getNameByValue(Integer value){
        return Arrays.asList(InquirerRelationEnum.values()).stream().filter(s -> s.getValue().equals(value)).findFirst().get().getName();
    }

    public static Map<Integer, String> getByValue(Set<Integer> values){
        Map<Integer, String> map = new HashMap<>();
        Arrays.asList(InquirerRelationEnum.values()).stream()
                .filter(s -> values.contains(s.getValue())).forEach(s -> map.put(s.getValue(), s.getName()));
        return map;
    }

}
